<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加学生</title>

</head>
<body>

<%
    Object oname=session.getAttribute("name");
    if(oname==null){
        request.setAttribute("msg","请登录后查看");
        request.getRequestDispatcher("login.jsp").forward(request,response);
    }
    String id = request.getParameter("id");
    //1、注册驱动（公司报道）
    Class.forName("com.mysql.cj.jdbc.Driver");
    //2、获取连接（中标造桥）
    Connection connection = DriverManager.getConnection("jdbc:mysql://mysql.zhledu.cn:3306/school", "school", "zhli2008");
    //3、创建执行对象（获取货车）
    Statement stmt = connection.createStatement();
    //4、创建sql语句（下达命令）
    String sql = "SELECT * from t_user where id=" + id;
    ResultSet rs = stmt.executeQuery(sql);
    String sno = "";
    String name = "";
    String sex = "";
    String clazz = "";
    String homepath = "";
    String phone = "";
    String username = "";
    String password = "";
    if (rs.next()) {
        sno = rs.getString("sno");
        name = rs.getString("name");
        sex = rs.getString("sex");
        clazz = rs.getString("clazz");
        homepath = rs.getString("home_path");
        phone = rs.getString("phone");
        username = rs.getString("username");
        password = rs.getString("password");
    }
    connection.close();
%>

<center>
    <form action="doAdd.jsp" method="post">
        <span style="color: red;font-weight: bold">${msg}</span>
        <table border="1px">
            <tr>
                <td>学号</td>
                <td><%=sno%>
                </td>
            </tr>
            <tr>
                <td>姓名</td>
                <td><%=name%>
                </td>
            </tr>
            <tr>
                <td>性别</td>
                <td>
                    <%=sex%>

                </td>
            </tr>
            <tr>
                <td>电话号码</td>
                <td><%=phone%>
                </td>
            </tr>
            <tr>
                <td>用户名</td>
                <td><%=username%>
                </td>
            </tr>
            <tr>
                <td>密码</td>
                <td><%=password%>
                </td>
            </tr>
            <tr>
                <td>班级</td>
                <td><%=clazz%>
                </td>
            </tr>
            <tr>
                <td>根目录</td>
                <td><%=homepath%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <a href="index.jsp">关闭</a>
                </td>
            </tr>
        </table>


    </form>


</center>


</body>
</html>
